package cn.iocoder.yudao.module.promotion.dal.mysql.domainmanage;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.domainmanage.vo.DomainManageExportReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.domainmanage.vo.DomainManagePageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.domainmanage.DomainManageDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 域名管理 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface DomainManageMapper extends BaseMapperX<DomainManageDO> {

    default PageResult<DomainManageDO> selectPage(DomainManagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DomainManageDO>()
                .likeIfPresent(DomainManageDO::getName, reqVO.getName())
                .eqIfPresent(DomainManageDO::getDomain, reqVO.getDomain())
                .eqIfPresent(DomainManageDO::getType, reqVO.getType())
                .eqIfPresent(DomainManageDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DomainManageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DomainManageDO::getId));
    }

    default List<DomainManageDO> selectList(DomainManageExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DomainManageDO>()
                .likeIfPresent(DomainManageDO::getName, reqVO.getName())
                .eqIfPresent(DomainManageDO::getDomain, reqVO.getDomain())
                .eqIfPresent(DomainManageDO::getType, reqVO.getType())
                .eqIfPresent(DomainManageDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DomainManageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DomainManageDO::getId));
    }


    default List<DomainManageDO> selectList(DomainManagePageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DomainManageDO>()
                .likeIfPresent(DomainManageDO::getName, reqVO.getName())
                .eqIfPresent(DomainManageDO::getDomain, reqVO.getDomain())
                .eqIfPresent(DomainManageDO::getType, reqVO.getType())
                .eqIfPresent(DomainManageDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DomainManageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DomainManageDO::getId));
    }

}
